import { ogImage, OG_SIZE, OG_CONTENT_TYPE } from '@/lib/og'; import { getDrugBySlug } from '@/lib/queries/drugs'; import { fmtInt, humanize } from '@/lib/format'; export const alt = 'CancerIndex drug page'; export const size = OG_SIZE; export const contentType = OG_CONTENT_TYPE; export const revalidate = 3600; export default async function Image({ params }: { params: Promise<{ slug: string }> }) { const { slug } = await params; const d = await getDrugBySlug(slug); if (!d) return ogImage({ kicker: 'Drug', title: 'Drug not found', subtitle: slug }); const facts = [ d.approval_count ? { label: 'approval records', value: fmtInt(d.approval_count) } : null, d.trial_count ? { label: 'registered trials', value: fmtInt(d.trial_count) } : null, d.evidence_count ? { label: 'curated evidence items', value: fmtInt(d.evidence_count) } : null, ].filter((f): f is { label: string; value: string } => !!f); return ogImage({ kicker: `Drug${d.kind ? ` · ${humanize(d.kind)}` : ''}${d.chembl_id ? ` · ${d.chembl_id}` : ''}`, title: d.name, subtitle: d.mechanism ?? d.description ?? 'Jurisdiction-aware approvals, curated evidence, development pipeline and clinical trials.', facts, sourcesNote: 'openFDA · Health Canada · EMA · CIViC · ClinicalTrials.gov', }); }